/*
 * Copyright (c) 2010 - 2011, Brookhaven National Laboratory
 * All rights reserved.
 * The software in this package is published under the terms
 * of the BSD license a copy of which has been included with
 * this distribution in the license.txt file.
 */


package org.oxtypes.impl;

import java.util.Collections;
import java.util.List;

import org.omg.dds.type.dynamic.DynamicTypeMember;
import org.omg.dds.type.dynamic.MemberDescriptor;
import org.omg.dds.type.dynamic.AnnotationDescriptor;

import org.oxtypes.impl.modifiable.ModifiableMemberDescriptorImpl;

/**
 *
 */
public class DynamicTypeMemberImpl extends DDSObjectImpl implements DynamicTypeMember {
    
    public DynamicTypeMemberImpl(MemberDescriptor descriptor, 
            List<AnnotationDescriptor> annotations){

        // has to be replaced with a new unmodifiable deep copy 
        // at this time, spec does not provide the corresponding
        // method.
        this.descriptor = descriptor;
        this.annotations = annotations;   
    }

    public MemberDescriptor getDescriptor(){
        return descriptor;
    }

    public List<AnnotationDescriptor> getAnnotations(){
        return Collections.unmodifiableList(annotations);
    }

    public void applyAnnotation(AnnotationDescriptor descriptor){
        throw new java.lang.UnsupportedOperationException();
    }

    public int getId(){
        return descriptor.getId();
    }

    public String getName(){
        return descriptor.getName();
    }

    // members

    private MemberDescriptor descriptor;
    private List<AnnotationDescriptor> annotations;

}
